{include file="public/head" /}
<body>
{include file="public/menu" /}
<div class="recharge">
    <div class="wrap">
        <div class="subnav commonTab">
            <span class="ac">余额提现</span>
        </div>
        <ul id="content">
            <li class="showli">
                <form action="" onSubmit="return false">
                    <h3>
                        <span class="label">账户余额：</span><span class="color">{$member.money}元</span>
                    </h3>
                    <div class="money">
                        <label>提现金额(元)：</label>
                        <input type="text" id="money" onkeyup="getFee(this)" class="recharge-amount amount1">
						<p style="font-size: 10px;color: #fd7400;margin-top: 11px;" class="feenote"><span class="label"></span>单笔提现手续费￥{:confv('fee2')}</p>
                    </div>
					<div class="money">
						<label>到账银行：</label>
						<select name="bank" id="bank" style="width: 320px; height: 40px; border: 1px solid #dbdbdb;">
							<option value="">-选择银行卡-</option>
							{volist name="CardList" id="vo"}
							<option value="{$vo.id}">{:PutPrivateNumber($vo.bank_number)}[{$vo.bank_name}]</option>
							{/volist}
						</select>
					</div>
                    <div class="money">
                        <label>到账金额(元)：</label>
                        <input type="text" id="actMoney" class="recharge-amount amount1" readonly>
                    </div>
                    <div class="money">
                        <label>支付密码：</label>
                        <input type="password" id="paypass" class="recharge-amount amount1" />
                    </div>
                    <div class="next next1">
                        <span class="label"></span>
                        <input type="submit" id="QUICKPC" value="确认提现">
						<p style="font-size: 16px;color: #cccccc;margin-top: 11px;text-align: center;"><span class="label"></span>注：最低提现金额￥{:confv('min-getcash')}  </p>
                    </div>
                </form>
            </li>
        </ul>
    </div>
</div>
{include file="public/foot" /}
</body>
{include file="public/load_bottom" /}
<script>
    $(function(){
        var subnav = $('.subnav').find('span')
        var li = $('#content').find('li')
        subnav.click(function(){
            $(this).addClass('ac').siblings().removeClass('ac')
            li.eq($(this).index()).addClass('showli').siblings().removeClass('showli')
        })
    })
	
	function getFee(obj){
		var oo = $(obj).val();
		var fee2 = "{:confv('fee2')}" * 1;
		if(oo != ''){
			var am = oo *1 - fee2;
			if(am > 0){
				$('#actMoney').val(am.toFixed(2))
			}else{
				$('#actMoney').val('')
			}
			
		}else{
			$('#actMoney').val('')
		}
	}
	
	$('#QUICKPC').click(function(){
		 var reg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/;
//		var reg = /^[1-9]\d*0{2}$/;
		 var val = $('#money').val();
		 var bank = $('#bank').val();
		 var paypass = $('#paypass').val();
		 if(!reg.test(val)||val==0||val==''){
			layer.msg('请输入正确的金额');
			return false;
		 }
		 if(val < {:confv('min-getcash')}){
			layer.msg('最低提现金额'+{:confv('min-getcash')}+'元');
			return false;
		 }
		 if(bank == ''){
			layer.msg('请选择到账银行卡');
			return false;
		 }
		 if(paypass.length<6){
			layer.msg('支付密码不能少于6位');
			return false;
		 }
		 var index = layer.load(0, {shade: false});
		 $('#QUICKPC').attr('disabled',true);
		 $.ajax({
			url: "{:url('Yun/Tixian')}",
			type:"POST",
			dataType:"JSON",
			data:{money:val,bank:bank,pwd:paypass},
			success:function(msg){
				layer.close(index);
				$('#QUICKPC').attr('disabled',false);
				if(msg.status == 1){
					layer.alert(msg.info,function(){
						window.location.href = msg.url;
					})
				}else{
					layer.msg(msg.info);
				}
			}
		 })
	})
</script>
</html>